#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve(vector<vector<char>> &carpet, int k, int x, int y, int size){
    if(k==0)
        return;
    int news = size / 3;
    for (int i = x + news; i < x + 2 * news;++i){
        for (int j = y + news; j < y + 2 * news;++j){
            carpet[i][j] = '.';
        }
    }
    for (int i = 0; i < 3;++i){
        for (int j = 0; j < 3;++j){
            if(i!=1||j!=1){
                solve(carpet, k - 1, x + i * news, y + j * news, news);
            }
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    int size = 1;
    for (int i = 0; i < n; i++){
        size *= 3;
    }
    vector<vector<char>> carpet(size, vector<char>(size, '#'));
    solve(carpet, n, 0, 0, size);
    for (auto row : carpet){
        for (char c : row){
            cout << c;
        }
        cout << endl;
    }

    return 0;  
}